home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 June / CHIP Haziran 2001.iso / prog / haziran / 19 / setup.exe / data.z / int_gui.frm < prev    next >
Text File  |  2001-04-11  |  10KB  |  331 lines

  1. VERSION 5.00
  2. Begin VB.Form int_gui 
  3.    BorderStyle     =   1  'Fixed Single
  4.    Caption         =   "Interrupt listener"
  5.    ClientHeight    =   3348
  6.    ClientLeft      =   48
  7.    ClientTop       =   336
  8.    ClientWidth     =   4968
  9.    Icon            =   "int_gui.frx":0000
  10.    LinkTopic       =   "Form1"
  11.    MaxButton       =   0   'False
  12.    MinButton       =   0   'False
  13.    ScaleHeight     =   3348
  14.    ScaleWidth      =   4968
  15.    StartUpPosition =   3  'Windows Default
  16.    Begin VB.Frame Frame1 
  17.       Caption         =   "IRQ Selection"
  18.       Height          =   2052
  19.       Left            =   240
  20.       TabIndex        =   6
  21.       Top             =   120
  22.       Width           =   4452
  23.       Begin VB.ComboBox ReqIrqList 
  24.          Height          =   288
  25.          ItemData        =   "int_gui.frx":0442
  26.          Left            =   1200
  27.          List            =   "int_gui.frx":0476
  28.          Style           =   2  'Dropdown List
  29.          TabIndex        =   1
  30.          Top             =   240
  31.          Width           =   2172
  32.       End
  33.       Begin VB.CheckBox Check11 
  34.          Alignment       =   1  'Right Justify
  35.          Appearance      =   0  'Flat
  36.          BackColor       =   &H8000000A&
  37.          Enabled         =   0   'False
  38.          ForeColor       =   &H80000008&
  39.          Height          =   192
  40.          Left            =   3720
  41.          TabIndex        =   19
  42.          Top             =   1440
  43.          Value           =   1  'Checked
  44.          Width           =   252
  45.       End
  46.       Begin VB.CheckBox Check9 
  47.          Alignment       =   1  'Right Justify
  48.          Appearance      =   0  'Flat
  49.          BackColor       =   &H8000000A&
  50.          Enabled         =   0   'False
  51.          ForeColor       =   &H80000008&
  52.          Height          =   192
  53.          Left            =   3000
  54.          TabIndex        =   18
  55.          TabStop         =   0   'False
  56.          Top             =   1680
  57.          Value           =   1  'Checked
  58.          Width           =   252
  59.       End
  60.       Begin VB.CheckBox Check8 
  61.          Alignment       =   1  'Right Justify
  62.          Appearance      =   0  'Flat
  63.          BackColor       =   &H8000000A&
  64.          Enabled         =   0   'False
  65.          ForeColor       =   &H80000008&
  66.          Height          =   192
  67.          Left            =   3000
  68.          TabIndex        =   17
  69.          TabStop         =   0   'False
  70.          Top             =   1440
  71.          Value           =   1  'Checked
  72.          Width           =   252
  73.       End
  74.       Begin VB.CheckBox Check7 
  75.          Alignment       =   1  'Right Justify
  76.          Appearance      =   0  'Flat
  77.          BackColor       =   &H8000000A&
  78.          Enabled         =   0   'False
  79.          ForeColor       =   &H80000008&
  80.          Height          =   192
  81.          Left            =   3000
  82.          TabIndex        =   16
  83.          TabStop         =   0   'False
  84.          Top             =   1200
  85.          UseMaskColor    =   -1  'True
  86.          Value           =   1  'Checked
  87.          Width           =   252
  88.       End
  89.       Begin VB.CheckBox Check6 
  90.          Appearance      =   0  'Flat
  91.          BackColor       =   &H8000000A&
  92.          Enabled         =   0   'False
  93.          ForeColor       =   &H80000008&
  94.          Height          =   192
  95.          Left            =   2280
  96.          TabIndex        =   15
  97.          Top             =   1680
  98.          Value           =   1  'Checked
  99.          Width           =   252
  100.       End
  101.       Begin VB.CheckBox Check3 
  102.          Appearance      =   0  'Flat
  103.          BackColor       =   &H8000000A&
  104.          Enabled         =   0   'False
  105.          ForeColor       =   &H80000008&
  106.          Height          =   192
  107.          Left            =   1800
  108.          TabIndex        =   14
  109.          Top             =   1680
  110.          Value           =   1  'Checked
  111.          Width           =   252
  112.       End
  113.       Begin VB.CheckBox Check2 
  114.          Appearance      =   0  'Flat
  115.          BackColor       =   &H8000000A&
  116.          Enabled         =   0   'False
  117.          ForeColor       =   &H80000008&
  118.          Height          =   192
  119.          Left            =   1800
  120.          TabIndex        =   13
  121.          Top             =   1440
  122.          Value           =   1  'Checked
  123.          Width           =   252
  124.       End
  125.       Begin VB.Label Label8 
  126.          Alignment       =   2  'Center
  127.          Caption         =   "Win95   Win98   WinNT4.0   Win2000"
  128.          Height          =   252
  129.          Left            =   1392
  130.          TabIndex        =   12
  131.          Top             =   960
  132.          Width           =   2940
  133.       End
  134.       Begin VB.Label Label7 
  135.          Caption         =   "12: Mouse"
  136.          Height          =   252
  137.          Left            =   240
  138.          TabIndex        =   11
  139.          Top             =   1680
  140.          Width           =   852
  141.       End
  142.       Begin VB.Label Label6 
  143.          Caption         =   "6:   Floppy Disk (A:)"
  144.          Height          =   252
  145.          Left            =   240
  146.          TabIndex        =   10
  147.          Top             =   1440
  148.          Width           =   1572
  149.       End
  150.       Begin VB.Label Label5 
  151.          Caption         =   "1:   Keyboard."
  152.          Height          =   252
  153.          Left            =   240
  154.          TabIndex        =   9
  155.          Top             =   1200
  156.          Width           =   1092
  157.       End
  158.       Begin VB.Label Label4 
  159.          Caption         =   "Common IRQs:"
  160.          Height          =   252
  161.          Left            =   120
  162.          TabIndex        =   8
  163.          Top             =   720
  164.          Width           =   1212
  165.       End
  166.       Begin VB.Line Line1 
  167.          BorderWidth     =   2
  168.          DrawMode        =   14  'Copy Pen
  169.          X1              =   120
  170.          X2              =   4200
  171.          Y1              =   660
  172.          Y2              =   660
  173.       End
  174.       Begin VB.Label Label3 
  175.          Caption         =   "Select IRQ:"
  176.          Height          =   252
  177.          Left            =   120
  178.          TabIndex        =   7
  179.          Top             =   300
  180.          Width           =   960
  181.       End
  182.    End
  183.    Begin VB.TextBox IntCount 
  184.       Alignment       =   2  'Center
  185.       Appearance      =   0  'Flat
  186.       BackColor       =   &H80000018&
  187.       Enabled         =   0   'False
  188.       Height          =   285
  189.       Left            =   3480
  190.       TabIndex        =   4
  191.       TabStop         =   0   'False
  192.       Text            =   "0"
  193.       Top             =   2400
  194.       Width           =   735
  195.    End
  196.    Begin VB.CommandButton DisEnInt_Button 
  197.       Caption         =   "Enable Interrupt"
  198.       Height          =   372
  199.       Left            =   480
  200.       TabIndex        =   0
  201.       Top             =   2280
  202.       Width           =   1572
  203.    End
  204.    Begin VB.CommandButton Exit_Button 
  205.       Caption         =   "Exit"
  206.       Height          =   372
  207.       Left            =   3240
  208.       TabIndex        =   3
  209.       Top             =   2880
  210.       Width           =   1215
  211.    End
  212.    Begin VB.CommandButton About_Button 
  213.       Caption         =   "About"
  214.       Height          =   372
  215.       Left            =   600
  216.       TabIndex        =   2
  217.       Top             =   2880
  218.       Width           =   1215
  219.    End
  220.    Begin VB.Label Label1 
  221.       Caption         =   "Interrupt count:"
  222.       Height          =   252
  223.       Left            =   2280
  224.       TabIndex        =   5
  225.       Top             =   2400
  226.       Width           =   1212
  227.    End
  228. End
  229. Attribute VB_Name = "int_gui"
  230. Attribute VB_GlobalNameSpace = False
  231. Attribute VB_Creatable = False
  232. Attribute VB_PredeclaredId = True
  233. Attribute VB_Exposed = False
  234. '
  235. ' File - int_gui.frm - code
  236. '
  237. ' This application catches interrupts that are genereted by the
  238. ' computer components, and is controlled via a graphical user
  239. ' interface - int_gui.frm
  240. ' The interrupts are detected using WinDriver functions.
  241. '
  242.  
  243. Private hWD As Long
  244. Private lastIrq As Integer
  245. Private CurIrq As Integer
  246. Dim fStart As Boolean
  247.  
  248. Private Sub About_Button_Click()
  249.     MsgBox "Interrupt listener Sample v1.0" & Chr$(13) & Chr$(13) & _
  250.     "This sample catches hardware interrupts" & Chr$(13) _
  251.     & " through the WinDriver's Visual Basic interface." _
  252.     & Chr$(13) & Chr$(13) & "Copyright (c) 2000 Jungo" _
  253.            , vbOKOnly, "About the Interrupt listener Sample"
  254. End Sub
  255.  
  256. Private Sub Exit_Button_Click()
  257.     If (fStart) Then
  258.         Interrupt_Thread_Disable hWD
  259.     End If
  260.     
  261.     Int_Close hWD
  262.     Unload int_gui
  263. End Sub
  264.  
  265. Private Sub Form_Load()
  266.     int_gui.ReqIrqList.ListIndex = 1
  267.     lastIrq = 1
  268.     CurIrq = 1
  269.     If (Not Int_Open(hWD)) Then
  270.         Unload int_gui
  271.         GoTo finish
  272.     End If
  273.     
  274.     fStart = False
  275.     
  276. finish:
  277. End Sub
  278.  
  279. Private Sub DisEnInt_Button_Click()
  280.     fStart = Not fStart
  281.     
  282.     If (fStart) Then
  283.         If (Check_ReqIrq) Then
  284.             If (Not Interrupt_Thread_Enable(hWD, g_intrp, CurIrq)) Then
  285.                 fStart = Not fStart
  286.                 CurIrq = lastIrq
  287.                 int_gui.ReqIrqList.ListIndex = lastIrq
  288.             Else
  289.                 int_gui.DisEnInt_Button.Caption = "Disable IRQ " & int_gui.ReqIrqList.ListIndex
  290.             End If
  291.         Else
  292.             fStart = Not fStart
  293.         End If
  294.     Else
  295.         int_gui.DisEnInt_Button.Caption = "Enable Interrupt"
  296.         Interrupt_Thread_Disable hWD
  297.     End If
  298. End Sub
  299.  
  300. Private Function Check_ReqIrq() As Boolean
  301.     Dim status
  302.     
  303.     If (int_gui.ReqIrqList.ListIndex = CurIrq) Then
  304.         int_gui.IntCount = 0
  305.         Check_ReqIrq = True
  306.         GoTo finish
  307.     End If
  308.     
  309.     status = MsgBox("Not all the IRQs are sharable. Listen to some" & Chr$(13) _
  310.     & "of them may be harmful to your application." & Chr$(13) _
  311.     & Chr$(13) & "                   Are you sure ?", vbYesNo + vbQuestion, "Did you know")
  312.     If (status <> vbYes) Then
  313.         int_gui.ReqIrqList.ListIndex = CurIrq
  314.         Check_ReqIrq = False
  315.         GoTo finish
  316.     End If
  317.  
  318.     lastIrq = CurIrq
  319.     CurIrq = int_gui.ReqIrqList.ListIndex
  320.     int_gui.IntCount = 0
  321.     Check_ReqIrq = True
  322.  
  323. finish:
  324. End Function
  325.  
  326. Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
  327.     If (UnloadMode = vbFormControlMenu) Then
  328.     Exit_Button_Click
  329.     End If
  330. End Sub
  331.